<template>
	<view class="page" @click="showTickTip = false">
		<u-swiper :list="imgArr"
			 previousMargin="100"
			 nextMargin="100"
			 circular
			 :effect3d="true"
			 :autoplay="true"
			 radius="5"
			 bgColor="#ffffff"
			 @click="toDetail">
		 </u-swiper>
		<view class="menu">
			<view class="item-container">
				<view class="box" @click="toFreeClass()">
					<view class="content"  hover-class="clickHover" hover-stay-time="0">
						<view class="iconfont icon-jiaoxuelou1"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">空闲教室</view>
					</view>
				</view>
				<view class="box">
					<view class="content" @click="toCountDown()"  hover-class="clickHover"hover-stay-time="0">
						<view class="iconfont icon-rili4"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">考试安排</view>
					</view>
				</view>
				<view class="box">
					<view class="content" @click="toChooseCourse()"  hover-class="clickHover" hover-stay-time="0">
						<view class="iconfont icon-xuanze"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">选分统计</view>
					</view>
				</view>
			</view>
			<view class="item-container">
				<view class="box" @click="toEvaluate()">
					<view class="content"  hover-class="clickHover" hover-stay-time="0">
						<view class="iconfont icon-pingjiao"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">一键评教</view>
					</view>
				</view>
				<view class="box" @click="getScore()">
					<view class="content"  hover-class="clickHover" hover-stay-time="0">
						<view class="iconfont icon-kechengbiao"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">成绩查询</view>
					</view>
				</view>
				<view class="box" @click="toMiTa()">
					<view class="content"  hover-class="clickHover" hover-stay-time="0">
						<view class="iconfont icon-yhcz"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">仲园觅Ta</view>
					</view>
				</view>
			</view>
			<view class="item-container">
				<view class="box" @click="toDepartMent()">
					<view class="content"  hover-class="clickHover" hover-stay-time="0">
						<view class="iconfont icon-wenhuashetuan"
							style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #23b8ff;"></view>
						<view class="text">部员课表</view>
					</view>
				</view>

				<view class="box" @click="toTaoShu()">
					<view class="content"  hover-class="clickHover" hover-stay-time="0">
						<view class="logo_image">
							<image src="../../static/images/taoShu.jpg" mode="aspectFill"></image>
						</view>
						<view class="text">仲园淘书</view>

					</view>
				</view>
			
			<view class="box" @click="toXianZhi()">
				<view class="content"  hover-class="clickHover" hover-stay-time="0">
					<view class="logo_image">
						<image src="http://1.14.247.152:9797/images/14032闲置.png" mode="widthFix"></image>

					</view>
					<view class="text">闲置交易</view>
				</view>
			</view>

				<!--	<view class="box" @click="toXianZhi()">
								<view class="content">
									<view class="xianZhiStyle">
										<image src="http://1.14.247.152:9797/images/14032闲置.png" mode="widthFix"></image>
									</view>
									<view class="text">闲置物品</view>
								</view>
							</view> -->
				
<!-- 			<view class="box" @click="tip()">
				<view class="content">
					<view class="iconfont icon-kaifazhongchuizi" style="font-size: 70rpx; font-weight: 700;margin-bottom: 20rpx;color: #ADADAD;"></view>
					<view class="text">开发中...</view>

				</view>
			</view> -->
		</view>
		<!-- <view class="item-container">
			<view class="box" @click="tip()">
				<view class="content">
					<view class="iconfont icon-kaifazhongchuizi"
						style="font-size: 50rpx; font-weight: 700;margin-bottom: 20rpx;color: #ADADAD;"></view>
					<view class="text">开发中...</view>
				</view>
			</view>
		</view> -->
	</view>
	<tickTip @closeTicket="closeTicket()" v-if="showTickTip" ></tickTip>
</view>
	
</template>

<script>
	import tickTip from "@/components/tickTip/tickTip.vue"
	export default {
		async onLoad() {
			let that = this;
			// uni.request({
			// 	url: "http://112.74.188.40:9001/lunbo",
			// 	success(res) {
			// 		res.data.data.list.forEach((item,index)=>{
			// 			that.imgArr.push(item.url)
			// 		})
			// 	}
			// })
			let res = await getApp().UniRequest("/lunbo", "get");
			res.data.list.forEach((item,index)=>{
						that.imgArr.push(item.url)
						that.srcArr.push(item.articleUrl)
					})
			console.log(res);
			uni.getSystemInfo({
				success: function(res) {
					let pxToRpxScale = 750 / res.windowWidth;
					// console.log(res.windowHeight);
					// console.log()
					that.height = res.windowHeight * pxToRpxScale;
				}
			});
		},
		onShow() {
			this.showTickTip = uni.getStorageSync('showTickTip')
			console.log(this.showTickTip,'数据111')
		},
		data() {
			return {
				showTickTip: false,
				height: 0,
				imgArr: [],
				srcArr:[]
			}
		},
		methods: {
			closeTicket() {
				// getApp().globalData.showTickTip = false;
				this.showTickTip = false;
				uni.setStorageSync('showTickTip',false);
			},
			toDetail(index){
				if(this.srcArr[index]!="一键评教"){
					uni.navigateTo({
						url: '/page_webview/webview?url=' + encodeURIComponent(this.srcArr[index])
					});
				}
				else{
					uni.navigateTo({
						url: '../../page_evaluation/evaluation/evaluation'
					});
				}
			},
			toFreeClass() {
					uni.navigateTo({
						url: '../../page_freeClassroom/freeClassroom/freeClassroom'
					});
			},
			toCountDown() {
					uni.navigateTo({
						url: '../../page_countDown/countDown/countDown'
					});
			},
			toChooseCourse() {
					uni.navigateTo({
						url: '../../page_courseRecord/courseRecord/courseRecord'
					});
			},
			toEvaluate() {
					uni.navigateTo({
						url: '../../page_evaluation/evaluation/evaluation'
					});
			},
			tip() {
				uni.showModal({
					title: '',
					content: '更多功能正在开发中...',
					showCancel: false,
					success: function() {

					}
				})
			},
			getScore() {
					uni.navigateTo({
						url: '../../page_score/score/score'
					});
			},
			toMiTa() {
					uni.navigateTo({
						url: '../../page_miTa/findHim/findHim'
					});
			},
			toDepartMent() {
					uni.navigateTo({
						url: '../../page_department/departmentIndex/departmentIndex'
					});
			},
			toTaoShu() {
					uni.navigateToMiniProgram({
						appId: 'wx9b9200fad0fe00e8',
						path: '',
						success(res) {
							// 打开成功
							console.log(res, '打开')
						},
						fail(error) {
							console.log(error, '失败')
						}
					})
				
			},
			toXianZhi() {
					uni.showToast({
						title:"敬请期待"
					})
					return;
					uni.navigateTo({
						url: '../../page_idle/idlePage'
					})
			}
		},
		components: {
			tickTip
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100vh;
		background-color: #f8f8f8;

		swiper {
			width: 100%;
			height: 300rpx;

			image {
				height: 100%;
				width: 100%;
			}
		}

		// .slide-show {
		// 	width: 100px;
		// 	height: 50px;
		// 	background-color: blue($color: #000000);
		// }
		.menu {
			background-color: #ffffff;
			width: 100%;
			padding: 0 8%;
			padding-top: 30rpx;
			// height: 700rpx;

			.item-container {
				display: flex;
				justify-content: space-between;
			}
			
			.clickHover {
				opacity: 0.9;
				background-color:#EBEBEB;
			}
			
			.box {
				width: 160rpx;
				height: 160rpx;
				// position: relative;
				// display: flex;
				// align-items: center;
				// justify-content: center;
				background-color: #FFFFFF;
				margin-bottom: 5rpx;
				border-radius: 10rpx;

				.content {

					height: 100%;
					width: 100%;
					padding: 0 20rpx 0 20rpx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;

					// position: absolute;
					// top: 50%;
					:nth-child(odd) {
						//消去前面的影响
						margin-right: 0rpx;
					}

					// margin-top: -60rpx;
					font-size: 28rpx;
					text-align: center;
					color: #5B5B5B;

					.logo_image {
						width: 60rpx;
						height: 60rpx;
						margin: 0 auto;
						margin-bottom: 12rpx;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.xianZhiStyle {
						width: 80%;
						display: flex;
						justify-content: center;
						align-items: center;
						margin: 0 auto;

						image {
							width: 50%;
							margin-bottom: 10rpx;
						}
					}
				}
			}
		}
	}
</style>
